package com.alageek.study.entity;

import com.alageek.study.api.Aggregate;
import com.alageek.study.api.Iterator;
import com.alageek.study.api.impl.BookShelfIterator;

import java.util.ArrayList;
import java.util.List;

public class BookShelf implements Aggregate {

    private List<Book> books;
    private Integer index;

    public BookShelf(int maxSize){
        books = new ArrayList<>(maxSize);
        index = 0;
    }

    public List<Book> getBooks() {
        return books;
    }

    public void setBooks(List<Book> books) {
        this.books = books;
    }

    public Integer getIndex() {
        return index;
    }

    public void setIndex(Integer index) {
        this.index = index;
    }

    @Override
    public Iterator iterator() {
        return new BookShelfIterator(this);
    }
}
